package com.cuit.riskassessment.service.impl;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cuit.riskassessment.dao.rc.RcMapper;
import com.cuit.riskassessment.service.RcService;
import com.cuit.riskassessment.vo.RCParam;
/**
 * RcService 的具体实现类
 * @author Yang_Zhiqin-pc
 *
 */
@Service(value="rcService")
public class RcServiceImpl implements RcService {

	@Autowired
	@Resource(name="rcMapper")
	private RcMapper rcMapper;
	
	@Override
	public boolean updateOrAdd(RCParam rc) {
		boolean flag = false;
		
		//Integer x = this.rcMapper.isRcExist(rc.getProjid());
		if(this.rcMapper.isRcExist(rc.getProjid())<1)
		{
			flag = this.rcMapper.addRc(rc)>0?true:false;
		}else
		{
			flag = this.rcMapper.updateRc(rc)>0?true:false;
		}
		return flag;
	}

	@Override
	public RCParam getRc(int projid) {
		// TODO Auto-generated method stub
		return this.rcMapper.getRc(projid);
	}

}
